@extends("backend.layout.main")

@section("before.css")


    <link type="text/css" href="/backend/css/style2.css" rel="Stylesheet">
    <link type="text/css" href="/backend/css/project.css" rel="Stylesheet">
    <link type="text/css" href="/backend/css/webuploader.css" rel="Stylesheet">
    <link type="text/css" href="/backend/css/animate.min.css" rel="Stylesheet">
    <link type="text/css" href="/backend/css/normalize.css" rel="Stylesheet">


@endsection
@section("right_content")

    <script type="text/javascript">



        function timer(intDiff,day1,hour1,minute1,second1){

            window.setInterval(function(){
                var day=0,
                        hour=0,
                        minute=0,
                        second=0;//时间默认值
                if(intDiff > 0){
                    day = Math.floor(intDiff / (60 * 60 * 24));
                    hour = Math.floor(intDiff / (60 * 60)) - (day * 24);
                    minute = Math.floor(intDiff / 60) - (day * 24 * 60) - (hour * 60);
                    second = Math.floor(intDiff) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
                }
                if (minute <= 9) minute = '0' + minute;
                if (second <= 9) second = '0' + second;

                $('#'+day1).html(day+"天");
                $('#'+hour1).html('<s id="h"></s>'+hour+'时');
                $('#'+minute1).html('<s></s>'+minute+'分');
                $('#'+second1).html('<s></s>'+second+'秒');
                intDiff--;
            }, 1000);
        }

        $(function(){
            $('.check').click(function(){

                 $.dialog('alert','提示','正在处理中...',0); //2s自动关闭

                var action=$(this).data('action');
                var id=$(this).data('task');
                var _Token="{{ csrf_token() }}";
                var info=$('.feedback-info').val();
                $.post('/backend/work/audit',{action:action,id:id,_Token:_Token,info:info},function(data){
                    $('#taskPanel').animate({
                        right:'-550px',
                    });

                    $.tooltip('操作成功',4000,true);//2s自动关闭

                    setTimeout('location.reload()',2000);
                })

            });


            $('.perMesg').mouseenter(function(){
                $(this).find('dd').addClass('showTrsm');
            }).mouseleave(function(){
                $(this).find('dd').removeClass('showTrsm');
            })
            //修改审核状态
            $("#uploadsave").on('click',function(){
                $.dialog('alert','提示','正在处理中...',0); //2s自动关闭
                var item_id=$('#item_id').val();
                var task_id=$('#task_id').val();
                var id=$('#id').val();
                var files_div=$('#tuo_file_name').children();
                var files="";
                var _Token="{{ csrf_token() }}";
                var comment=$('.updata_new_ins').val();
                files_div.each(function(){
                    files += $(this).attr('fileinfo')+",";
                });
                var a=$(this).data('id');
                var b=$('.audit[data-id='+a+']');
                $.post('/backend/work/check',{id:id,item_id:item_id,task_id:task_id,files:files,comment:comment,_Token:_Token},function(data){
                    if(data==1){

                        $.dialog('alert','提示','正在处理中...',1,function(){ $.tooltip('系统已收到您提交的成果，并通知审核人，相关文件可在任务文档中查看。',4000,true); }); //2s自动关闭
                        b.unbind('click');
                         b.removeClass();
                        b.html('<strong>审核中</strong>');
                    }else {
                        $.dialog('alert','提示','正在处理中...',1);
                        $.tooltip('上传失败',2000,false);//2s自动关闭
                        setTimeout(" $('.HTooHCloseBtnltip').hide()",3000);
                    }
                })


            })



        });
    </script>

<script type="text/javascript">
    $(function(){
        if($('.alertmsg').length){
            alert($('.alertmsg').html());
        }
    })
</script>



        <!--middle-->
    <div class="mainWrapBox">


            @if ($errors->has('messageOfStatus'))


            <div class="alertmsg hide">{{ $errors->first('messageOfStatus') }}</div>

            @endif


        <div class="mainBox">

    <div class="html">
        <div class="dashboard-title">一天的工作从设计协作开始.....






        <span style="float:right;margin-right:20px;"><a data-toggle="modal" data-target="#addcusPanel" onclick="getPanel()" href="javascript:void(0);">添加面板</a></span></div>
        <div class="dashboard-shortcut">
            <p><span class="title">快捷操作</span>


                <a href="javascript:;" data-toggle="modal" id="costPanel" class="primarybtn btn-border-gray ml30">记录支出</a>
                <a href="/backend/work/expense/showdownload" class="primarybtn btn-border-gray ml30">审核支出</a>

            </p>
            <p><span class="title">快速链接</span>

            </p>
        </div>
        <div id="dashboard-link-container" class="dashboard-link-container" style="display: none">

        </div>
<ul id="dashboard-panel-container" class="dashboard-panel-container clearfix ui-sortable">

    <!--  未分配任务项目 -->
    @if(!empty($i_names))
        <li data="12" id="li_12" associate_id="445" sort="1" large_url="" url="user/panel/latelytask.htm" class="li-sort">
            <div class="panel-item" id="dataGrid_12">
                <div class="header">未分配任务项目
                    <ul class="toolbar">
                        <li class="icon-move"></li>
                        <li id="init_large_12" class="icon-max"></li>
                        <li id="init_small_12" style="display: none;" onclick="fangda(12,&#39;init_small_&#39;,&#39;width:48%&#39;, false)" class="icon-min"></li>
                        <li class="icon-delete" onclick="deleteAssocitate(12)"></li>

                    </ul>
                </div>
                <div class="body of300">
                   <ul style="margin-top: 20px">
                        @foreach($i_names as $k=>$v)
                         <li ><a href="/backend/items/task/{{ $v['id'] }}">#{{ $v['item_name'] }}</a></li>
                       <div style="clear: both;"></div>
                    @endforeach
                    </ul>
            </div>

            </div>
        </li>
        @endif
                <!--   end      -->

	 <li data="12" id="li_12" associate_id="445" sort="1" large_url="" url="user/panel/latelytask.htm" class="li-sort">
		 <div class="panel-item" id="dataGrid_12">
         <div class="header">近期我的任务
            <ul class="toolbar">
	            <li class="icon-move"></li>
	            <li id="init_large_12" class="icon-max"></li>
               <li id="init_small_12" style="display: none;" onclick="fangda(12,&#39;init_small_&#39;,&#39;width:48%&#39;, false)" class="icon-min"></li>
	           <li class="icon-delete" onclick="deleteAssocitate(12)"></li>

           </ul>
        </div>
<div class="body of300">
    <table style="margin:20px 0;line-height: 34px;height: 34px;width: 100%;table-layout: fixed;border: 1px solid  rgb(204, 204, 204);">
        <tbody>
        @foreach($tasks as $k=>$v)
            <tr style="border-bottom: 1px solid #eee;">
                <td colspan="2"> <div class="project-name"><a href="/backend/items/task/{{ $v['item_id'] }}">#{{ $v['item_name'] }}</a></div></td>
                <td><div class="project-people">高级景观设计师：{{ $v['username'] }}</div></td>
            </tr>

            <tr style="border: 1px solid  rgb(204, 204, 204);">
                <td>
                    @foreach($v['common'] as $item=>$value)
                        <div id="over-time">
                            <div class="time-item">
                                <span id="day_show_{{ $k.$item }}">0天</span>
                                <strong id="hour_show_{{ $k.$item }}">00时</strong>
                                <strong id="minute_show_{{ $k.$item }}">00分</strong>
                                <strong id="second_show_{{ $k.$item }}">00秒</strong>
                            </div>
                            <script>
                                var day1="day_show_{{ $k.$item }}";
                                var hour1="hour_show_{{ $k.$item }}";
                                var minute1="minute_show_{{ $k.$item }}";
                                var second1="second_show_{{ $k.$item }}";
                                var time="{{ strtotime($value['task_deadline'])-time() }}";
                                var intDiff = parseInt(time);//倒计时总秒数量
                                if(time >0){
                                    timer(intDiff,day1,hour1,minute1,second1);
                                }
                            </script>
                        </div>
                    @endforeach
                </td>
                <td>
                    @foreach($v['common'] as $item=>$value)
                        <div id="task-list">
                            <p>
                                <span>{{ trans('items.item_stage_'.$value['stage_id']) }}/</span>
                                <label data-task="{{$value['id']}}" data-item="{{ $value['item_id']}}" data-check="{{ $value['member_id_check'] }}" data-status="{{ $value['task_status'] }}">{{ $value['task_name'] }}</label>
                            </p>
                        </div>
                    @endforeach
                </td>
                <td>
                    @foreach($v['common'] as $item=>$value)
                        <div id="task-check">

                            @if($value['task_status']==10)
                                <p>

                                    <span  class="audit primarybtn btn-border-gray" data-id="{{$value['id']}}" data-item="{{ $value['item_id']}}" data-task="{{ $value['task_id']}}">{{ trans('items.task_status_'.$value['task_status']) }}</span>

                                </p>
                            @else
                                <p>
                            <span>
                        <strong>{{ trans('items.task_status_'.$value['task_status']) }}</strong>
                    </span>
                                </p>
                            @endif

                        </div>
                    @endforeach
                </td>

            </tr>
        @endforeach
        </tbody></table>

</div>

</div>
</li>



    <li data="12" id="li_12" associate_id="445" sort="1" large_url="" url="user/panel/latelytask.htm" class="li-sort">
        <div class="panel-item" id="dataGrid_12">
            <div class="header">近期我的审核
                <ul class="toolbar">
                    <li class="icon-move"></li>
                    <li id="init_large_12" class="icon-max"></li>
                    <li id="init_small_12" style="display: none;" onclick="fangda(12,&#39;init_small_&#39;,&#39;width:48%&#39;, false)" class="icon-min"></li>
                    <li class="icon-delete" onclick="deleteAssocitate(12)"></li>
                </ul>
            </div>
            <div class="body of300">
                <table style="margin:20px 0;line-height: 34px;height: 34px;width: 100%;table-layout: fixed;border: 1px solid  rgb(204, 204, 204);">
                    <tbody>
                    @if($checks)
                    @foreach($checks as $k=>$v)
                        <tr style="border-bottom: 1px solid #eee;">
                            <td colspan="2"> <div class="project-name"><a href="/backend/items/task/{{ $v['item_id'] }}">#{{ $v['item_name'] }}</a></div></td>
                            <td><div class="project-people">高级景观设计师：{{ $v['username'] }}</div></td>
                        </tr>
                        <tr style="border: 1px solid  rgb(204, 204, 204);">
                            <td>
                                @foreach($v['common'] as $item=>$value)
                                    <div id="over-time">
                                        <div class="time-item">
                                            <span id="day_show_{{ $k.$item }}">0天</span>
                                            <strong id="hour_show_{{ $k.$item }}">00时</strong>
                                            <strong id="minute_show_{{ $k.$item }}">00分</strong>
                                            <strong id="second_show_{{ $k.$item }}">00秒</strong>
                                        </div>
                                        <script>
                                            var day1="day_show_{{ $k.$item }}";
                                            var hour1="hour_show_{{ $k.$item }}";
                                            var minute1="minute_show_{{ $k.$item }}";
                                            var second1="second_show_{{ $k.$item }}";
                                            var time="{{ strtotime($value['task_deadline'])-time() }}";
                                            var intDiff = parseInt(time);//倒计时总秒数量
                                            if(time >0){
                                                timer(intDiff,day1,hour1,minute1,second1);
                                            }
                                        </script>
                                    </div>
                                @endforeach
                            </td>
                            <td>
                                @foreach($v['common'] as $item=>$value)
                                    <div id="task-list">
                                        <p>
                                            <span>{{ trans('items.item_stage_'.$value['stage_id']) }}/</span>
                                            <label data-task="{{$value['id']}}" data-item="{{ $value['item_id']}}" data-check="{{ $value['member_id_check'] }}" data-status="{{ $value['task_status'] }}">{{ $value['task_name'] }}</label>
                                        </p>
                                    </div>
                                @endforeach
                            </td>
                            <td>
                                @foreach($v['common'] as $item=>$value)
                                    <div id="task-check">
                                        <p>
                                            <span  class="loadcheck primarybtn btn-border-gray"   data-task="{{$value['id']}}" data-item="{{ $value['item_id']}}" data-check="{{ $value['member_id_check'] }}" data-status="{{ $value['task_status'] }}">去审核</span>
                                        </p>
                                    </div>
                                @endforeach
                            </td>

                        </tr>
                    @endforeach
                        @endif
                    </tbody></table>
            </div>

        </div>
    </li>


 <!--         -->
<li data="8" id="li_8" associate_id="41" sort="2" large_url="" url="user/panel/project_time.htm" class="li-sort">
 <div class="panel-item" id="dataGrid_8">	
 <div class="header">本月项目工时排名 · 全公司
 <ul class="toolbar">
	 <li class="icon-move"></li>
	 <li id="init_large_8" onclick="fangda(8,&#39;init_large_&#39;,&#39;width:100%&#39;, true)" class="icon-max"></li>
     <li id="init_small_8" style="display: none;" onclick="fangda(8,&#39;init_small_&#39;,&#39;width:48%&#39;, false)" class="icon-min"></li>
	 <li class="icon-delete" onclick="deleteAssocitate(8)"></li>

 </ul>

</div>
<div class="body of300">
 <!-- 内容 -->
</div>

</div>
</li>
<li data="15" id="li_15" associate_id="43" sort="3" large_url="" url="user/panel/oppstat.htm" class="li-sort">

<div class="panel-item" id="dataGrid_15">	
<div class="header">本月机会状态统计 · 全公司
<ul class="toolbar">
	<li class="icon-move"></li>
	<li id="init_large_15" onclick="fangda(15,&#39;init_large_&#39;,&#39;width:100%&#39;, true)" class="icon-max"></li>
    <li id="init_small_15" style="display: none;" onclick="fangda(15,&#39;init_small_&#39;,&#39;width:48%&#39;, false)" class="icon-min"></li>
	<li class="icon-delete" onclick="deleteAssocitate(15)"></li>

</ul>

</div>
<div class="body of300">
 <!-- 内容 -->
</div>
</div>
</li>

<li data="10" id="li_10" associate_id="444" sort="4" large_url="" url="user/panel/contract_remind.htm" class="li-sort">

<div class="panel-item" id="dataGrid_10">	
<div class="header">合同计划回款到期提醒 · 全公司
<ul class="toolbar">
	<li class="icon-move"></li>
	<li id="init_large_10" onclick="fangda(10,&#39;init_large_&#39;,&#39;width:100%&#39;, true)" class="icon-max"></li>
    <li id="init_small_10" style="display: none;" onclick="fangda(10,&#39;init_small_&#39;,&#39;width:48%&#39;, false)" class="icon-min"></li>
	<li class="icon-delete" onclick="deleteAssocitate(10)"></li>

</ul>
</div>
<div class="body of300">
<!-- 内容 -->
</div>
</div>
</li>

<li data="16" id="li_16" associate_id="44" sort="5" large_url="" url="user/panel/threadstat.htm" class="li-sort">

<div class="panel-item" id="dataGrid_16">	
<div class="header">本月线索状态统计 · 全公司
<ul class="toolbar">
	<li class="icon-move"></li>
	<li id="init_large_16" onclick="fangda(16,&#39;init_large_&#39;,&#39;width:100%&#39;, true)" class="icon-max"></li>
    <li id="init_small_16" style="display: none;" onclick="fangda(16,&#39;init_small_&#39;,&#39;width:48%&#39;, false)" class="icon-min"></li>
	<li class="icon-delete" onclick="deleteAssocitate(16)"></li>

</div>
<div class="body of300">
<!-- 内容 -->
</div>
</div>
</li>


<li data="11" id="li_11" associate_id="446" sort="6" large_url="" url="user/panel/latelyworking.htm" class="li-sort">

<div class="panel-item" id="dataGrid_11">	
<div class="header">最近正在做
<ul class="toolbar">
	<li class="icon-move"></li>
	<li id="init_large_11" onclick="fangda(11,&#39;init_large_&#39;,&#39;width:100%&#39;, true)" class="icon-max"></li>
    <li id="init_small_11" style="display: none;" onclick="fangda(11,&#39;init_small_&#39;,&#39;width:48%&#39;, false)" class="icon-min"></li>
	<li class="icon-delete" onclick="deleteAssocitate(11)"></li>

</ul>
</div>
<div class="body of300">
 <!-- 内容 -->
</div>
</div>
</li>

<li data="13" id="li_13" associate_id="447" sort="7" large_url="" url="user/panel/workhours.htm" class="li-sort">

<div class="panel-item" id="dataGrid_13">	
<div class="header">我的工时
<ul class="toolbar">
	<li class="icon-move"></li>
	<li id="init_large_13" onclick="fangda(13,&#39;init_large_&#39;,&#39;width:100%&#39;, true)" class="icon-max"></li>
    <li id="init_small_13" style="display: none;" onclick="fangda(13,&#39;init_small_&#39;,&#39;width:48%&#39;, false)" class="icon-min"></li>
	<li class="icon-delete" onclick="deleteAssocitate(13)"></li>

</ul>
</div>
<div class="body of300">
<!-- 内容 -->
</div>
</div>
</li>


<li data="17" id="li_17" associate_id="449" sort="8" large_url="user/panel/priority_task.htm" url="user/panel/priority_task_widght.htm" class="li-sort">

<div class="panel-item" id="dataGrid_17">	
<div class="header">项目里程碑任务 · 全公司
<ul class="toolbar">
	<li class="icon-move"></li>
	<li id="init_large_17" onclick="fangda(17,&#39;init_large_&#39;,&#39;width:100%&#39;, true)" class="icon-max"></li>
    <li id="init_small_17" style="display: none;" onclick="fangda(17,&#39;init_small_&#39;,&#39;width:48%&#39;, false)" class="icon-min"></li>
	<li class="icon-delete" onclick="deleteAssocitate(17)"></li>

</ul>
</div>
<div class="body of300">
<!-- 内容 -->
</div>
</div>
</li>

<li data="14" id="li_14" associate_id="448" sort="9" large_url="" url="user/panel/latestdynamic.htm" class="li-sort">

<div class="panel-item" id="dataGrid_14">	
<div class="header">最新动态<span class="ml20 greenColor"></span>
<ul class="toolbar">
	<li class="icon-move"></li>
	<li id="init_large_14" onclick="fangda(14,&#39;init_large_&#39;,&#39;width:100%&#39;, true)" class="icon-max"></li>
    <li id="init_small_14" style="display: none;" onclick="fangda(14,&#39;init_small_&#39;,&#39;width:48%&#39;, false)" class="icon-min"></li>
	<li class="icon-delete" onclick="deleteAssocitate(14)"></li>

</ul>
</div>
<div class="body" style="overflow-x: hidden">
<!-- 内容 -->
</div>
</div>
</li>

<li data="3" id="li_3" associate_id="1150" sort="10" large_url="" url="user/panel/monthcost.htm" class="li-sort">

<div class="panel-item" id="dataGrid_3">	

<form id="queryForm">
    <input type="hidden" id="year" name="year" value="2016">
</form>
<div class="header">月度成本统计
        <span class="primarybtn btn-border-gray ml30" id="yearSpan" onclick="WdatePicker({dateFmt: &#39;yyyy&#39;, isShowToday: false, isShowClear: false,qsEnabled:false,isShowOK:false,onpicked:selectYear});">2016</span>
    <span class="primarybtn btnGreen " id="excelData" style="display: none;">导出Excel</span>
<ul class="toolbar">

	<li class="icon-move"></li>
	        <li id="init_large_3" onclick="fangda(3,&#39;init_large_&#39;,&#39;width:100%&#39;, true)" class="icon-max"></li>
        <li id="init_small_3" style="display: none;" onclick="fangda(3,&#39;init_small_&#39;,&#39;width:48%&#39;, false)" class="icon-min"></li>
	<li class="icon-delete" onclick="deleteAssocitate(3)"></li>

</ul>
</div>
<div class="body of300">
<!-- 内容 -->
</div>
</div>
</li>

<li data="4" id="li_4" associate_id="1151" sort="11" large_url="" url="user/panel/new_contracts.htm" class="li-sort">

<div class="panel-item" id="dataGrid_4">	
<div class="header">月度新增合同额 · 全公司
<ul class="toolbar">
	<li class="icon-move"></li>
	<li id="init_large_4" onclick="fangda(4,&#39;init_large_&#39;,&#39;width:100%&#39;, true)" class="icon-max"></li>
    <li id="init_small_4" style="display: none;" onclick="fangda(4,&#39;init_small_&#39;,&#39;width:48%&#39;, false)" class="icon-min"></li>
	<li class="icon-delete" onclick="deleteAssocitate(4)"></li>

</ul>
</div>
<div class="body of300">
<!-- 内容 -->
</div>
</div>
</li>

<li data="6" id="li_6" associate_id="1152" sort="12" large_url="" url="user/panel/invoice_payment.htm" class="li-sort">

<div class="panel-item" id="dataGrid_6">	
<div class="header">月度开票与回款统计 · 全公司
<ul class="toolbar">
	<li class="icon-move"></li>
	<li id="init_large_6" onclick="fangda(6,&#39;init_large_&#39;,&#39;width:100%&#39;, true)" class="icon-max"></li>
    <li id="init_small_6" style="display: none;" onclick="fangda(6,&#39;init_small_&#39;,&#39;width:48%&#39;, false)" class="icon-min"></li>
	<li class="icon-delete" onclick="deleteAssocitate(6)"></li>

</ul>
</div>
<div class="body of300">
<!-- 内容 -->
</div>


</div>
</li>

<li data="21" id="li_21" associate_id="1153" sort="13" large_url="user/panel/hours_and_task_modal.htm" url="user/panel/hours_and_task.htm" class="li-sort">

<div class="panel-item" id="dataGrid_21">	
<div class="header">员工工时与任务统计 · 全公司
<ul class="toolbar">
	<li class="icon-move"></li>
	<li id="init_large_21" onclick="fangda(21,&#39;init_large_&#39;,&#39;width:100%&#39;, true)" class="icon-max"></li>
    <li id="init_small_21" style="display: none;" onclick="fangda(21,&#39;init_small_&#39;,&#39;width:48%&#39;, false)" class="icon-min"></li>
	<li class="icon-delete" onclick="deleteAssocitate(21)"></li>

</ul>
</div>
<div class="body of300">
<!-- 内容 -->
</div>
</div>
</li>

<li data="18" id="li_18" associate_id="1539" sort="14" large_url="" url="user/panel/warning_project.htm" class="li-sort">

<div class="panel-item" id="dataGrid_18">	        
<div class="header">预警项目列表 · 全公司
<ul class="toolbar">
	<li class="icon-move"></li>
	<li id="init_large_18" onclick="fangda(18,&#39;init_large_&#39;,&#39;width:100%&#39;, true)" class="icon-max"></li>
    <li id="init_small_18" style="display: none;" onclick="fangda(18,&#39;init_small_&#39;,&#39;width:48%&#39;, false)" class="icon-min"></li>
	<li class="icon-delete" onclick="deleteAssocitate(18)"></li>

</ul>
</div>
<div class="body of300">
 <!-- 内容 -->       
</div>
</div>
</li>
</ul>
</div>
</div>
<div class="modal-task" id="taskPanel" style="right:-550px">
   <div class="task-title line-break">
   <span>CAD图稿</span>

   <div class="task-title-menu"><img src="/backend/images/menu.png"></div>
   <div class="task-title-close"><img src="/backend/images/close.png"></div>

   </div>
   <div class="task-content clearfix task-detail">
        <div class="task-info">
            <div class="task-time">倒计时：XXXXXXXXX</div>
            <div class="task-great">
            <table>
               <tr>
                   <td>分配绩效</td>
                   <td>0</td>
               </tr>
               <tr>
                   <td>实际绩效</td>
                   <td>0</td>
               </tr>
            </table>
            </div>
            <div class="task-assess">
               <p>综合评分</p>
               <p>0</p>
            </div>
            <div class="task-assess-list">
              <div><label>质量</label><span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span></div>
              <div><label>服务</label><span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span></div>
              <div><label>速度</label><span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span></div>
            </div>
        </div>    
        <div class="task-doc mt10 line-break line-height30 clearfix">
 


          <div class="title" style="line-height:30px">
          项目文档


          </div>
            <div>
           <table width="100%">
              <tbody id="upload_text">


              </tbody>
           </table>
          </div>
        </div>
        <div class="task-activity  mt10 line-break line-height30 clearfix">
          <div class="title" style="line-height:30px">
                <div class="title-text title">项目记录</div>
                <div class="title-text title">反馈意见</div>
          </div>
          <table width="530px">
          <tbody id="logs">



          </tbody>
          </table>
            <table>
                <tbody>
                <tr>
                    <td></td>
                    <td></td>
                <td><div id="check-button">
                        <button type="button" class="btn green check-button-yes check" data-item="" data-task="" data-action="yes">通过</button>
                        <button type="button" class="btn waring check-button-no" >不通过</button>
                    </div>
                </td>
                </tr>
                </tbody>
            </table>

        </div>
       <div id="feedback-info">
           反馈意见：<textarea class="feedback-info"></textarea>
           <div class="textarea-button" style="display:block;">
               <a id="check" class="btn green check check-button-no1" data-item="" data-task="" data-action="no">提交</a>
           </div>
       </div>

   </div>
</div>




 <!-- 财务 start    -->
<div class="modal" id="taskpay" style="display:none;width:800px">


<form id="taskpay_form" method="post" action="/backend/work/expense" enctype="multipart/form-data"  accept-
charset="utf-8" >
  {{ csrf_field() }}
   <div class="modal-dialog" style="width:800px">
    <div class="modal-content">
        <div class="modal-header">
          <span class="modal-title"><em>费用支出</em></span>
        </div>
        <div class="clear"></div>
        <div class="modal-body cost-modal" style="padding:15px;max-height:750px">

           <div  class="xiansuo_add_sc" style="margin:20px 0px;width: 100%;">
              <select  class="h30" style="border: 1px solid #e4e4e4;display: inline-block;width: 100%; font-size:15px" name="did[]">
                 <option value="0">——选择关联项目——</option>
                <option value="-1">无关联项目</option>
                @foreach($join_item_name as $k=>$v)

                 <option value="{{ $k }}" >{{ $v['joinItemName'] }}</option>
                @endforeach

              </select>
           </div> 
           <div class="clear"></div>

             <div class="cost-area">
                            <p style="font-weight: bold;color:#808080">费用明细
                            <a class="f_r add_data" href="javascript:;"  style="cursor: pointer">+添加</a></p>
                            <table id="tmllist" class="tmllist" width="95%" style="margin-left:10px">
                                <thead class="xm_qx_header">
                                <tr>
                                    <th width="110px">费用类型</th>
                                    <th width="130px">金额</th>
                                    <th width="130px">时间</th>
                                    <th width="120px">描述</th>
                                    <th width="200px">上传凭证(可以多选)</th>
                                    <th width="30px"></th>
                                </tr>

                                </thead>
                                <tbody class="xm_qx_body" id="costDetailList">
                                    
                                </tbody>
                            </table>
        
            </div>
            <div>
            
             
            </div>
                 
           </div>
         <div class="modal-footer" style="display:block;">

            <input type="submit" value="保存凭证"  class="submit-close btn green" id="expense_uploadsave">

        </div>
        <div class="cl"></div>
    </div>
    </div>
  </form>
</div>



<!-- 财务 end -->



<!-- 上传组件 start -->
   <div class="modal" id="uploadmodal" style="display:none">
            <form id="upload_Form" enctype="multipart/form-data" method="post">
                <input type="hidden" id="item_id" name="item_id">
                <input type="hidden" id="task_id" name="task_id">
                <input type="hidden" id="id" name="id">

                <div data="check" class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header ">
                            <span class="modal-title"><em></em> </span>
     
                        </div>

                        <div class="modal-body" style="padding:15px">

                            <div class="juese_text_cont_input fontsize16">
                                <div class="updata_new_text upload_new_version">

                                    <label id="a-upload">添加本地文件(可多选)</label>

                                </div>
                                <div style="margin-top: 5px;" id="tuo_file_name">

                                </div>
                                <input type="hidden" id="upload_tuo_type">
                                <input type="text" class="updata_new_ins" placeholder="添加备注">
                            </div>

                        </div>
                        <div class="modal-footer" style="display:block;">         
                            <input type="button" data-id="0" id="uploadsave" class="btn green submit-close" value="保存">
                        </div>
                        <div class="cl"></div>
                    </div>
                </div>
            </form>
      </div>
    </div>
</div>


</div>

</div>
    <script src="/backend/js/jquery.hDialog.min.js"></script>
    <script src="/backend/js/webuploader.js"></script>
    <script src="/backend/js/uploadFiles.js"></script>

<script type="text/javascript" src="/backend/js/laydate.js"></script>


<script type="text/javascript">
  $('#task-list label,.loadcheck').click(function(){
      $('#taskPanel').animate({
        right:'0px',
    });
      var status=$(this).data('status');



    //  var check_id=$(this).data('check');
      if(status>=20&&status<30){

          $('#check-button').show();

      }else {
          $('#check-button').hide();
      }

    var item_id=$(this).data('item');
    var task_id=$(this).data('task');
      $('.check-button-yes').attr('data-item',item_id);
      $('.check-button-yes').attr('data-task',task_id);
      $('.check-button-no1').attr('data-item',item_id);
      $('.check-button-no1').attr('data-task',task_id);
      var _Token="{{ csrf_token() }}";
      $.post('/backend/work/accessory',{item_id:item_id,task_id:task_id,_Token:_Token,tag:0},function(data){


        var data=data;
        var task_name=data.name;
        var task_deadline=data.deadline;
        var accessorys=data.accessorys;
        var logs=data.logs;

        var path = data.path;

        var html_path="";


        if(path != 0){

           html_path = "<div class='title' id='need_file' style='line-height:30px'>所需资料<a href='/backend/work/newdownload/"+path+"' style='float: right;'>下载</a></div>";

            if( !$('#need_file').length ){

                $(".task-doc").append(html_path);

            }
          }

        $('.task-title span').text(task_name);
        $('.task-time').text('截止时间：'+task_deadline);
          var html="";
          var ht="";

          $.each(accessorys,function(i,item){
              html += "<tr><td width='60%'>"+item.path.replace(',','')+"</td> <td width='30%'>"+item.created_at.date.substring(0,item.created_at.date.indexOf('.'))+"</td><td width='10%'><a href='/backend/uploads/"+item.item_id+"/"+item.item_task_id+"/"+item.path.replace(',','')+"'>下载</a></td> </tr>";
          });



          $('#upload_text').empty();
          $('#upload_text').append(html);
          $.each(logs,function(i,item){
              ht += "<tr><td><span>"+item.created_at+"</span>"+item.action+"</td><td>"+item.comment+"</td></tr>";
          });
          $('#logs').empty();
          $('#logs').append(ht);

      },'json')

  });
  $('.task-title-close').click(function(){
    $('#taskPanel').animate({
        right:'-550px',
    });
  });

  function openuploadmodal(obj) {
    $(obj).hDialog({
       box:'#uploadmodal',
       width:520,
       positions: 'top',
       modalHide: false,
       closeBg: '#fff',
        beforeShow:function(){
            $('#tuo_file_name').html('');
        }

    }); //默认调用


}


//财务弹出
    function opentaskpay(obj) {
   
        $(obj).hDialog({
            box: '#taskpay',
            width:800,
            positions: 'center',
            modalHide: false,
            closeBg: '#fff',
            beforeShow:function(){

            }
        });
    }
    opentaskpay('#costPanel');

  $('.audit').click(function(){
     var item_id=$(this).data('item');
     var task_id=$(this).data('task');
      var id=$(this).data('id');
     $('#item_id').val(item_id);
     $('#task_id').val(task_id);
     $('#id').val(id);
      $('#uploadsave').attr('data-id',id);
  })
openuploadmodal('.audit');



$(document).on('click','.remove_window',function(){
    $(this).parent().parent().remove();
        for(var i=0;i<($('.expenseType').length);i++){

            $(".upload_file").eq(i).attr('name','file'+(i+1));
        }
})


$(document).on('click','.add_data',function(){
 var count = $('.expenseType').length+1;

    var html='<tr class="expenseType"><td><select name="type[]" style="height:25px"><option>费用类型</option><option value="1">差旅</option><option value="2">招待</option><option value="3">分包</option><option value="4">打印</option></select></td>';

        html+='<td><input type="text" class="width120" name="salary[]" placeholder="元"></td>';

        html+='<td><input onClick="laydate()" type="text" name="time[]" readonly="readonly" placeholder="请选择时间" style="width:120px;cursor:pointer;" /></td>';
        html+='<td><input type="text" style="width:120px"  name="description[]" placeholder="描述"/></td>';


        html+='<td><input placeholder="可以多选图片" type="file" class="upload_file" style="width:200px;margin-left:10px" name="file'+count+'[]" multiple /></td>';



        html+='<td><a class="btn modal-cancel" onclick="removeCostDetail(this);">X</a></td></tr>';
    $('#costDetailList').append(html);   


})

    function editDetailData(obj) {
        var text=$(obj).children().eq(0).html();
        $(obj).children().eq(1).val(text).removeClass('hide');
        $(obj).children().eq(0).addClass('hide');
    }

    function saveDetailData(obj) {
        var text=$(obj).val();
        $(obj).addClass('hide');
        $(obj).prev().html(text).removeClass('hide');
    }

    function removeCostDetail(obj){
    $(obj).parent().parent().remove();
    }

</script>

<script type="text/javascript">
    $(function(){

        

        var uplodFileNum = 10 ;
        var fileNum ;
        var uploaderObj ;
        uploaderObj = new uploaderFile('tuo_file_name','a-upload');

    
})


    $('.check-button-no').click(function(){
        if($('#feedback-info').css('display')=='none'){
            $('#feedback-info').show();
        }else{
            $('#feedback-info').hide();
        }
    })


    $(document).on('click',function(){
        if($('#taskPanel').css('right')=='-550px'){
            $('#feedback-info').hide();
            $('.feedback-info').val('');
        }
    })

</script>
    @endsection
